// pages/home/home.js
var e = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    topImage:"http://www.ylhzzy.top:8828/public/uploads/home/topImage.PNG",
    imageUrl: "http://www.ylhzzy.top:8828/public",
    cates: [
      {
        img_url:"/uploads/home/categoryIcons/swcx.png",
        title1:"石纹抽象",
        title2:"素材",
        id:974
      },
      {
        img_url:"/uploads/home/categoryIcons/xzs.png",
        title1:"新中式",
        title2:"素材",
        id:969
      },
      {
        img_url:"/uploads/home/categoryIcons/xdbo.png",
        title1:"现代北欧",
        title2:"素材",
        id:986
      },
      {
        img_url:"/uploads/home/categoryIcons/zs.png",
        title1:"中式",
        title2:"素材",
        id:981
      },
      {
        img_url:"/uploads/home/categoryIcons/qsxk.png",
        title1:"轻奢悬空",
        title2:"素材",
        id:16402
      },
      {
        img_url:"/uploads/home/categoryIcons/gssn.png",
        title1:"格栅/收纳",
        title2:"素材",
        id:1035
      },
      {
        img_url:"/uploads/home/categoryIcons/mld.png",
        title1:"莫兰迪",
        title2:"素材",
        id:16392
      },
      {
        img_url:"/uploads/home/categoryIcons/gjdb.png",
        title1:"高精大板",
        title2:"素材",
        id:1014
      },
      {
        img_url:"/uploads/home/categoryIcons/hqb.png",
        title1:"护墙板",
        title2:"配件",
        id:1022
      },
      {
        img_url:"/uploads/home/categoryIcons/xgfs.png",
        title1:"玄关/复式",
        title2:"素材",
        id:16394
      },
      {
        img_url:"/uploads/home/categoryIcons/zsh.png",
        title1:"装饰画",
        title2:"素材",
        id:995
      },
      {
        img_url:"/uploads/home/categoryIcons/lmz.png",
        title1:"罗马柱",
        title2:"素材",
        id:990
      }
    ],

    products:[
      {
        img_url:"/uploads/home/bigBtn/1.png",
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      /*var r = this;
      e.request({
          url: e.rserver + "/productApi/getProductCatList",
          method: "POST",
          data: {
              token: e.token
          },
          header: {
              "content-type": "application/x-www-form-urlencoded"
          },
          success: function(e) {
              r.setData({
                  cates: e.data.result.productCats.slice(0, 12) || []
              });
          }
      });*/
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },



  onClickBtn:function(e)
  {
      console.log(e.currentTarget.dataset.item);
      let index = e.currentTarget.dataset.item
      wx.navigateTo({
        url: "/pages/products/products?id=" + this.data.cates[index].id
    });
  }
})